

package com.hazelcast.transaction.impl;

import com.hazelcast.spi.impl.NodeEngine;
import com.hazelcast.transaction.TransactionOptions;
import com.hazelcast.transaction.impl.operations.*;

import java.util.List;
import java.util.UUID;

public class AllowedDuringPassiveStateTransactionImpl extends TransactionImpl {

    public AllowedDuringPassiveStateTransactionImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngine nodeEngine, TransactionOptions options, UUID txOwnerUuid) {
        super(transactionManagerService, nodeEngine, options, txOwnerUuid);
    }

    // used by tx backups
    AllowedDuringPassiveStateTransactionImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngine nodeEngine, UUID txnId, List<TransactionLogRecord> transactionLog, long timeoutMillis, long startTime, UUID txOwnerUuid) {
        super(transactionManagerService, nodeEngine, txnId, transactionLog, timeoutMillis, startTime, txOwnerUuid);
    }

    @Override
    protected CreateTxBackupLogOperation createCreateTxBackupLogOperation() {
        return new CreateAllowedDuringPassiveStateTxBackupLogOperation(getOwnerUuid(), getTxnId());
    }

    @Override
    protected ReplicateTxBackupLogOperation createReplicateTxBackupLogOperation() {
        return new ReplicateAllowedDuringPassiveStateTxBackupLogOperation(getTransactionLog().getRecords(), getOwnerUuid(), getTxnId(), getTimeoutMillis(), getStartTime());
    }

    @Override
    protected RollbackTxBackupLogOperation createRollbackTxBackupLogOperation() {
        return new RollbackAllowedDuringPassiveStateTxBackupLogOperation(getTxnId());
    }

    @Override
    protected PurgeTxBackupLogOperation createPurgeTxBackupLogOperation() {
        return new PurgeAllowedDuringPassiveStateTxBackupLogOperation(getTxnId());
    }

}
